<?php

require_once(dirname(__FILE__) . '/../../article/actions/components.class.php');
class bottomArticlesWidgetComponents extends myComponents
{

	
  public function executeRender(){
	$this->bottomArticle = $this->getQuery()->execute()->getFirst();

	//$this->socialBanners = $this->getBanners('socials');
	//$this->footerBanners = $this->getBanners('footer');

	

	

  }


  protected function getBanners($type){
	return Doctrine_Query::create()
				->from('Banner b')
				->innerJoin('b.BannerGroup bg WITH bg.type = ?', $type)
				->innerJoin('bg.StructureBannerGroups sbg')
				->innerJoin('sbg.Structure s WITH s.lang = ?', $this->getRoute()->getObject()->getLang())
				->setHydrationMode(Doctrine::HYDRATE_ARRAY)
				->execute();
			
  }

  
  protected function getQuery(){
  	$q = Doctrine::getTable('Structure')->createQuery('ba')
  		->from('Structure s')
		->where('s.lang = ?', $this->getRoute()->getObject()->getLang())
		->andWhere('s.parameter = ?', 'footer')
		->limit(1);
	
	return $q;
  }
  
  
}